<template>
  <div class="conWidth" style="height: 100%">
    <div class="logo"><img :src="imgHost + webSetUp.logo" alt="" /></div>
    <div class="article">
      <i class="el-icon-back" @click="$router.go(-1)"></i>
      <h2>{{ article.title }}</h2>
      <div class="flexbox attribute">
        <div class="date centerBox">
          <i class="el-icon-date"></i>
          <span>{{ article.time }}</span>
        </div>
        <div class="see centerBox">
          <i class="el-icon-collection-tag"></i>
          <span>{{ article.category_name }}</span>
        </div>
      </div>
      <div v-html="article.content">123</div>
    </div>
    <Footer class="footer" />
  </div>
</template>

<script>
import Footer from "@/components/footer/footer.vue";
export default {
  components: { Footer },
  data() {
    return {
      webSetUp: {},
      article: {},
    };
  },
  created() {
    this.webSetUp = JSON.parse(localStorage.getItem("webSetUp"));
    console.log(this.$route);
    this.query(this.$route.params.id);
  },
  methods: {
    query(id) {
      this.$http
        .get("articlelist", { params: { id } })
        .then((result) => {
          this.article = result[0];
        })
        .catch((err) => {
          this.$message.success(err);
        });
    },
  },
};
</script>

<style lang="less" scoped>
.logo {
  text-align: center;
  img {
    width: 200px;
    height: 200px;
  }
}
.el-icon-back {
  font-size: 24px;
  cursor: pointer;
}
.article {
  h2 {
    margin: 30px 0 20px;
    font-size: 30px;
  }
  .attribute {
    & > div {
      margin-right: 10px;
      margin-bottom: 10px;
      i {
        margin-right: 5px;
      }
    }
  }
}
.footer {
  position: absolute;
  bottom: 0;
  left: 0;
}
</style>